package com.pacai.homework;

import java.util.Scanner;

/**
 * @author pacai
 * @version 1.0
 */
public class HomeWork15 {

}

@SuppressWarnings("all")
class Gress{
    public static void game(int gametime){
        int times = 0;
        int player;
        Scanner sc = new Scanner(System.in);
        for (int j = 0; j < gametime; j++) {
            int pc = ((int)Math.random()*2);
            while(true) {
                try {
                    player = sc.nextInt();
                    if(pc < 0 || pc > 2)
                        throw new RuntimeException();
                    break;
                } catch (Exception e) {
                    System.out.println("输入的数字错误");
                }
            }
            if(pc > player || pc == 2 && player == 0){
                System.out.println("玩家");
                times++;
            }else{
                System.out.println("电脑");
            }
        }
        System.out.println("你赢了" + times + "局");
    }
}